package org.jeecg.modules.charge.controller;

import java.util.List;
import io.swagger.annotations.ApiParam;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.SsoUtil;
import org.jeecg.entity.charge.ChargeFeeCategory;
import org.jeecg.modules.charge.service.IChargeFeeCategoryService;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

 /**
 * @Description: 收费项分类
 * @Author: liurui
 * @Date:   2021-06-24
 * @Version: V1.0
 */
@Slf4j
@Api(tags="收费项分类")
@RestController
@RequestMapping("/b/charge/chargeFeeCategory")
public class ChargeFeeCategoryController {
	@Autowired
	private IChargeFeeCategoryService chargeFeeCategoryService;

	@GetMapping("/getFeeCategory")
	@ApiOperation(value = "获取报表分类，根据父分类的ID获取")
	public Result<List<ChargeFeeCategory>> getFeeCategory(@ApiParam(value = "父分类Id，可以为空") @RequestParam(required = false) Integer parentId) {
		List<ChargeFeeCategory> feeReportTypes = chargeFeeCategoryService.getFeeCategory(parentId);
		return Result.data(feeReportTypes);
	}
	@GetMapping("/getFeeCategoryParentId")
	@ApiOperation(value = "获取报表分类，根据父分类的ID获取")
	public Result<Integer> getFeeCategoryParentId(@RequestParam("id") Integer id) {
		Integer parentId = chargeFeeCategoryService.getFeeCategoryParentId(id);
		return Result.data(parentId);
	}



}
